<template>
	<view
		:style="'order:'+Item.order+';'+Item.css"
		class="list-roll">
		<view class="left">
			<text :class="'iconfont '+Item.iconfont" :style="Item.leftCss+'font-weight: normal;font-style: normal;'"></text>
			<text :style="Item.leftCss">{{Item.text}}</text>
		</view>
		<view class="rigth">
			<swiper
				autoplay="true"
				interval="5000"
				vertical="true">
				<template v-if="list.length">
					<swiper-item v-for="item in list">
						<view @click="$_To('post/post?pid=' + item.pid)">
							{{item.title ? item.title : $_filterHtml(item.content)}}
						</view>
					</swiper-item>
				</template>
				<template v-else>
					<swiper-item>
						<view>Loading...</view>
					</swiper-item>
				</template>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		name:"list-roll",
		props:{
			Item:{
				type:Object,
				default:null
			},
			YrConfig:{
				type:String,
				default:""
			}
		},
		data() {
			return {
				list:[]
			};
		},
		mounted() {
			this.$_Request(
				"GET","/api/v2/post/list",
				{
					"mapId": this.Item.query.mapId,
					"mapLng": this.Item.query.mapLng,
					"mapLat": this.Item.query.mapLat,
					"uidOrUsername": this.Item.query.uidOrUsername,
					"hid": this.Item.query.hid,
					"gid": this.Item.query.gid,
					"includeSubgroups": this.Item.query.includeSubgroups,
					"allDigest": this.Item.query.allDigest,
					"digestState": this.Item.query.digestState,
					"stickyState": this.Item.query.stickyState,
					"contentType": this.Item.query.contentType,
					"createdDays": this.Item.query.createdDays,
					"createdDate": this.Item.query.createdDate,
					"createdDateGt": this.Item.query.createdDateGt,
					"createdDateLt": this.Item.query.createdDateLt,
					"likeCountGt": this.Item.query.likeCountGt,
					"likeCountLt": this.Item.query.likeCountLt,
					"followCountGt": this.Item.query.followCountGt,
					"followCountLt": this.Item.query.followCountLt,
					"blockCountGt": this.Item.query.blockCountGt,
					"blockCountLt": this.Item.query.blockCountLt,
					"commentCountGt": this.Item.query.commentCountGt,
					"commentCountLt": this.Item.query.commentCountLt,
					"orderType": this.Item.query.orderType,
					"orderDirection": this.Item.query.orderDirection,
					"blockGroups": this.Item.query.blockGroups + this.YrConfig,
					"blockHashtags": this.Item.query.blockHashtags,
					"pluginRatingId": this.Item.query.pluginRatingId,
					"pageSize": this.Item.query.pageSize,
					"whitelistKeys":"pid,title,content"
				},
				(res) => {
					this.list = res.data.data.list;
				}
			)
		}
	}
</script>

<style lang="scss" scoped>
.list-roll{
	overflow: hidden;
	display: flex;
	align-items: center;
	height: 60rpx;
	.left{
		display: flex;
		align-items: center;
		flex-shrink: 0;
		text{
			font-size: 22rpx;
			padding: 0 15rpx 0 10rpx;
		}
		.iconfont{
			padding: 0 0 0 25rpx;
			font-size: 35rpx;
		}
	}
	.rigth{
		flex: 1;
		margin-right: 25rpx;
		swiper{
			width: 100%;
			swiper-item{
				display: flex;
				align-items: center;
				view{
					display: flex;
					align-items: center;
					font-size: 22rpx;
					width: 100%;
					align-items: center;
					display: -webkit-box;
					/*!autoprefixer:off*/
					-webkit-box-orient: vertical;
					/*autoprefixer:on*/
					-webkit-line-clamp: 1;
					overflow: hidden;
				}
			}
			
		}
	}
}
</style>